package zucc.lcj.android_finalwork;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

import androidx.annotation.Nullable;

public class MyDatabaseHelper extends SQLiteOpenHelper {
    public static final String CREATE_UserInfo="create table UserInfo (" +
            "user_id integer primary key autoincrement," +
            "user_name text," +
            "user_pwd text," +
            "user_header blob," +
            "isWechat integer," +
            "helpPost Integer," +
            "integral Integer," +
            "helpNum Integer," +
            "medal Integer,"  +
            "user_sex text," +
            "user_age Integer)";
    public static final String CREATE_WechatMen="create table WechatMen (" +
            "wechatMen_id integer primary key autoincrement," +
            "wechatMen_user Integer," +
            "wechatMen_name text," +
            "wechatMen_sex text," +
            "wechatMen_age Integer)";
    public static final String CREATE_WechatWomen="create table WechatWomen (" +
            "wechatWomen_id integer primary key autoincrement," +
            "wechatWomen_user Integer," +
            "wechatWomen_name text," +
            "wechatWomen_sex text," +
            "wechatWomen_age Integer)";
    public static final String CREATE_Help="create table Help (" +
            "help_id integer primary key autoincrement," +
            "help_title text," +
            "help_content text," +
            "help_state integer," +
            "help_photo text," +
            "help_userPost integer," +
            "help_userHelp integer," +
            "help_time text)";
    public static final String CREATE_Model="create table Model (" +
            "model_id integer primary key autoincrement," +
            "model_time date," +
            "model_num integer," +
            "model_user text)";
    private Context mContext;

    public MyDatabaseHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        mContext=context;
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_UserInfo);
        sqLiteDatabase.execSQL(CREATE_WechatMen);
        sqLiteDatabase.execSQL(CREATE_WechatWomen);
        sqLiteDatabase.execSQL(CREATE_Help);
        sqLiteDatabase.execSQL(CREATE_Model);
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,1)");
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,2)");
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,3)");
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,4)");
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,5)");
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,6)");
//        sqLiteDatabase.execSQL("insert into Model(model_time,model_sum,model_num) values('2000-11-20',0,7)");
//        sqLiteDatabase.execSQL("insert into UserInfo values(1,'123')");
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}

